<template>
  <a-card :bordered="false">
    <!-- 查询区域 -->
    <div class="table-page-search-wrapper">
      <a-form layout="inline" @keyup.enter.native="searchQuery">
        <a-row :gutter="24">
          <a-col :span="6">
            <a-form-item :label="$t('message.facilities_activities')">
              <j-input :placeholder="$t('message.Please_enter')" v-model="queryParam.name" style="width: 100%;"></j-input>
            </a-form-item>
          </a-col>
          <a-col :span="6">
            <a-form-model-item label="">
              <a-button type="primary" @click="searchQuery">{{ $t('message.Search') }}</a-button>
              <a-button style="margin-left: 8px" @click="searchReset">{{ $t('message.Reset') }}</a-button>
            </a-form-model-item>
          </a-col>
        </a-row>
      </a-form>
    </div>
    <!-- 查询区域-END -->

    <!-- 操作按钮区域 -->
    <div class="table-operator">
      <a-button @click="handleAdd" type="primary" icon="plus"> {{ $t('message.add_facilities_activities') }}</a-button>
    </div>

    <!-- table区域-begin -->
    <div>
      <a-table
        ref="table"
        size="middle"
        :scroll="{x:true}"
        bordered
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        @change="handleTableChange">

        <template slot="operation" slot-scope="text, record, index">
          <div class="editable-row-operations">
            <a style="margin-right: 24px" @click="() => handleEdit(record)">{{ $t('message.Edit') }}</a>
            <a @click="() => handleDelete(record.id)">{{ $t('message.Delete') }}</a>
          </div>
        </template>
      </a-table>
    </div>

    <cy-org-activitie-modal ref="modalForm" @ok="modalFormOk"></cy-org-activitie-modal>
  </a-card>
</template>

<script>

  import '@/assets/less/TableExpand.less'
  import { mixinDevice } from '@/utils/mixin'
  import { JeecgListMixin } from '@/mixins/JeecgListMixin'
  import CyOrgActivitieModal from './modules/CyOrgActivitieModal'

  export default {
    name: 'activitie',
    mixins:[JeecgListMixin, mixinDevice],
    components: {
      CyOrgActivitieModal
    },
    data () {
      return {
        description: '活动设施表管理页面',
        // 表头
        columns: [
          {
            title:this.$t('message.facilities_activities'),
            align:"center",
            dataIndex: 'name'
          },
          {
            title: this.$t('message.Handle'),
            align: 'center',
            width: 100,
            scopedSlots: {customRender: 'operation'},
          }
        ],
        url: {
          list: "/orgActivitie/list",
          delete: "/orgActivitie/delete",
          deleteBatch: "/orgActivitie/deleteBatch",
          exportXlsUrl: "/orgActivitie/exportXls",
          importExcelUrl: "orgActivitie/importExcel",

        },
        dictOptions:{},
        superFieldList:[],
      }
    },
    created() {
    this.getSuperFieldList();
    },
    computed: {
      importExcelUrl: function(){
        return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`;
      },
    },
    methods: {
      initDictConfig(){
      },
      getSuperFieldList(){
        let fieldList=[];
        fieldList.push({type:'string',value:'name',text:'活动设施名称',dictCode:''})
        fieldList.push({type:'string',value:'orgId',text:'组织id',dictCode:''})
        fieldList.push({type:'string',value:'deptId',text:'部门id',dictCode:''})
        fieldList.push({type:'string',value:'delFlag',text:'删除标志',dictCode:''})
        this.superFieldList = fieldList
      }
    }
  }
</script>
<style scoped>
  @import '~@assets/less/common.less';
</style>
